<?php
require_once '../config/config.php';
require_once '../config/connexion_db.php';

   if (isset($_POST['envoyer'])){
     if(isset($_POST['raison_sociale']))      $raison_sociale=$_POST['raison_sociale'];
        else      $raison_sociale="";
     if(isset($_POST['Adresse']))      $Adresse=$_POST['Adresse'];
        else      $Adresse="";
     if(isset($_POST['telephone']))      $telephone=$_POST['telephone'];
        else      $telephone="";
     if(isset($_POST['fax']))      $fax=$_POST['fax'];
        else      $fax="";
     if(isset($_POST['email']))      $email=$_POST['email'];
        else      $email="";
     if(isset($_POST['observation']))      $observation=$_POST['observation'];
        else      $observation="";
      $sql = "INSERT INTO carnet_adresses.entreprises(id, raison_sociale, adresse, telephone, fax, email, observations)  VALUES (NULL, '$raison_sociale', '$Adresse', '$telephone', '$fax', '$email', '$observation')";
      $envoi_requete = mysqli_query($connexion_serveur, $sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
//      echo ' Nouvelle entreprise enregistrée';
    }
?>

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title>AJOUTER D'UNE ENTREPRISE</title>
        <link href="../bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet">
        <link href="../css/style.css" type="text/css" rel="stylesheet">
    </head>
    <body>
         <?php 
        require_once "../config/css_js_bootstrap/css_js_bootstrap.php"; 
        require_once '../config/menus/menu_principal.php';
        ?>
        <div id="fiche">
        <br><div id="div2">
        <a href="liste_entreprises.php">Retour à la liste des entreprises</a>
        <br></div>
        <br><div id="div2">
            <h3>Ajouter une entreprise</h3>
        <form name="ajouter_entreprise" id="ajouter_entreprise" method="post" action="" enctype="multipart/form-data">
            <table>
                <tr>
                    <td class="col1">Raison sociale:</td>
                    <td class="col2"><input type="text" name="raison_sociale" id="raison_sociale" maxlength="25" size="25"></td>
                </tr>
                <tr>
                    <td class="col1">Adresse:</td>
                    <td class="col2"><textarea name="Adresse" id="Adresse" cols="40" rows="5" placeholder="Adresse..."></textarea></td>
                </tr> 
                <tr>
                    <td class="col1">Telephone:</td>
                    <td class="col2"><input type="text" name="telephone" id="telephone" maxlength="13" size="13"></td>
                </tr>    
                <tr>
                    <td class="col1">Fax:</td>
                    <td class="col2"><input type="text" name="fax" id="fax" maxlength="13" size="13"></td>
                </tr>
                <tr>
                    <td class="col1">Email:</td>
                    <td class="col2"><input type="text" name="email" id="email" maxlength="30" size="40"></td>
                </tr> 
                <tr>
                    <td class="col1">Observation:</td>
                    <td class="col2"><textarea name="observation" id="observation" cols="60" rows="5" placeholder="Observation..."></textarea></td>
                </tr> 
                    <td class="col1"></td>
                    <td class="col2"><input type="submit" name="envoyer" value="Envoyer" /></td>
                </tr>
            </table>   
            
        </form>
        </div>
       </div>
    </body>
</html>
